package com.sofar.mybatisplus.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sofar.mybatisplus.entity.TblProduct;
import com.sofar.mybatisplus.entity.common.AjaxResult;
import com.sofar.mybatisplus.entity.common.Result;
import com.sofar.mybatisplus.service.TblProductService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (TblProduct)表控制层
 *
 * @author makejava
 * @since 2022-08-31 09:06:46
 */
@RestController
@RequestMapping("tblProduct")
public class TblProductController {
    /**
     * 服务对象
     */
    @Resource
    private TblProductService tblProductService;

    /**
     * 分页查询
     * @param tblProduct
     * @return
     */
    @PostMapping("/queryByPage")
    public AjaxResult queryByPage(@RequestBody TblProduct tblProduct) {
        IPage<TblProduct> page = new Page<>(tblProduct.getPageNum(),tblProduct.getPageSize());
        IPage<TblProduct> iPage = tblProductService.queryByPage(tblProduct, page);
        return Result.success(iPage);
    }

}

